package com.wnm.web;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.wnm.pojo.Category;
import com.wnm.service.CategoryService;
import com.wnm.service.impl.CategoryServiceImpl;

@WebServlet("/category/*")
public class CategoryServlet extends BaseServlet {
	public void findAllCategory(HttpServletRequest request, HttpServletResponse response) {
		CategoryService categoryService = new CategoryServiceImpl();
		List<Category> categorys = categoryService.findAllCategory();
		ObjectMapper om = new ObjectMapper();
		try {
			om.writeValue(response.getWriter(), categorys);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
